package com.common.retrofit.methods;

import com.common.retrofit.base.BaseMethods;
import com.common.retrofit.entity.result.RegisterBean;
import com.common.retrofit.service.HaiNingService;


import rx.Observable;
import rx.Subscriber;

public class RegisterMethods extends BaseMethods {

    private static RegisterMethods m_ins = null;

    public static RegisterMethods getInstance() {
        if (m_ins == null) {
            synchronized (RegisterMethods.class) {
                if (m_ins == null) {
                    m_ins = new RegisterMethods();
                }
            }
        }
        return m_ins;
    }

    @Override
    protected String getHttpUrl() {
        return "User/";
    }

    private HaiNingService initService() {
        return getRetrofit().create(HaiNingService.class);
    }


    public void register(Subscriber<RegisterBean> subscriber,
                      String mobile,
                      String checkcode ,String password ) {
        Observable observable = initService().register(System.currentTimeMillis()+"",
                "4451e241ca3c437dab2f23aae6994963",mobile,checkcode,password
        );
        toSubscribe(observable, subscriber);
    }
}
